~ubuntu-branches/ubuntu/vivid/libav/vivid

« back to all changes in this revision

Viewing changes to libavformat/network.c

  • Committer: Package Import Robot
  • Author(s): Reinhard Tartler
  • Date: 2013-10-22 23:24:08 UTC
  • mfrom: (1.3.36 sid)
  • Revision ID: package-import@ubuntu.com-20131022232408-b8tvvn4pyzri9mi3
Tags: 6:9.10-1ubuntu1
* Build all -extra flavors from this source package, as libav got demoted
  from main to universe, cf LP: #1243235
* Simplify debian/rules to follow exactly the code that debian executes
* New upstream (LP: #1180288) fixes lots of security issues (LP: #1242802)
* Merge from unstable, remaining changes:
  - build-depend on libtiff5-dev rather than libtiff4-dev,
    avoids FTBFS caused by imlib
  - follow the regular debian codepaths

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 
21
21
#include "network.h"
22
22
#include "libavcodec/internal.h"
23
 
 
24
 
#define THREADS (HAVE_PTHREADS || (defined(WIN32) && !defined(__MINGW32CE__)))
25
 
 
26
 
#if THREADS
 
23
#include "libavutil/mem.h"
 
24
 
 
25
#if HAVE_THREADS
27
26
#if HAVE_PTHREADS
28
27
#include <pthread.h>
29
28
#else
34
33
#if CONFIG_OPENSSL
35
34
#include <openssl/ssl.h>
36
35
static int openssl_init;
37
 
#if THREADS
 
36
#if HAVE_THREADS
38
37
#include <openssl/crypto.h>
39
38
#include "libavutil/avutil.h"
40
39
pthread_mutex_t *openssl_mutexes;
55
54
#endif
56
55
#if CONFIG_GNUTLS
57
56
#include <gnutls/gnutls.h>
58
 
#if THREADS && GNUTLS_VERSION_NUMBER <= 0x020b00
 
57
#if HAVE_THREADS && GNUTLS_VERSION_NUMBER <= 0x020b00
59
58
#include <gcrypt.h>
60
59
#include <errno.h>
61
 
#undef malloc
62
 
#undef free
63
60
GCRY_THREAD_OPTION_PTHREAD_IMPL;
64
61
#endif
65
62
#endif
71
68
    if (!openssl_init) {
72
69
        SSL_library_init();
73
70
        SSL_load_error_strings();
74
 
#if THREADS
 
71
#if HAVE_THREADS
75
72
        if (!CRYPTO_get_locking_callback()) {
76
73
            int i;
77
74
            openssl_mutexes = av_malloc(sizeof(pthread_mutex_t) * CRYPTO_num_locks());
87
84
    openssl_init++;
88
85
#endif
89
86
#if CONFIG_GNUTLS
90
 
#if THREADS && GNUTLS_VERSION_NUMBER < 0x020b00
 
87
#if HAVE_THREADS && GNUTLS_VERSION_NUMBER < 0x020b00
91
88
    if (gcry_control(GCRYCTL_ANY_INITIALIZATION_P) == 0)
92
89
        gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
93
90
#endif
102
99
#if CONFIG_OPENSSL
103
100
    openssl_init--;
104
101
    if (!openssl_init) {
105
 
#if THREADS
 
102
#if HAVE_THREADS
106
103
        if (CRYPTO_get_locking_callback() == openssl_lock) {
107
104
            int i;
108
105
            CRYPTO_set_locking_callback(NULL);
164
161
        return AVERROR(EAGAIN);
165
162
    case WSAEINTR:
166
163
        return AVERROR(EINTR);
 
164
    case WSAEPROTONOSUPPORT:
 
165
        return AVERROR(EPROTONOSUPPORT);
 
166
    case WSAETIMEDOUT:
 
167
        return AVERROR(ETIMEDOUT);
 
168
    case WSAECONNREFUSED:
 
169
        return AVERROR(ECONNREFUSED);
 
170
    case WSAEINPROGRESS:
 
171
        return AVERROR(EINPROGRESS);
167
172
    }
168
173
    return -err;
169
174
}
182
187
 
183
188
    return 0;
184
189
}
185