[vlc-commits] access:avio: remove dead code

Steve Lhomme git at videolan.org
Sat Jul 8 18:39:56 CEST 2017


vlc | branch: master | Steve Lhomme <robux4 at videolabs.io> | Fri Jul  7 09:20:37 2017 +0200| [984571cc5ce7b4cbee4f87bb8a629c419e0be5b9] | committer: Jean-Baptiste Kempf

access:avio: remove dead code

We require libavformat >= 57

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=984571cc5ce7b4cbee4f87bb8a629c419e0be5b9
---

 modules/access/avio.c | 93 ---------------------------------------------------
 1 file changed, 93 deletions(-)

diff --git a/modules/access/avio.c b/modules/access/avio.c
index 771ee919f5..529a660eec 100644
--- a/modules/access/avio.c
+++ b/modules/access/avio.c
@@ -36,20 +36,6 @@
 #include "avio.h"
 #include "../codec/avcodec/avcommon.h"
 
-#if LIBAVFORMAT_VERSION_MAJOR < 54
-# define AVIOContext URLContext
-
-# define avio_open url_open
-# define avio_close url_close
-# define avio_read url_read
-# define avio_seek url_seek
-# define avio_pause av_url_read_pause
-
-# define AVIO_FLAG_READ URL_RDONLY
-# define AVIO_FLAG_WRITE URL_WRONLY
-# define avio_size url_filesize
-#endif
-
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
@@ -92,33 +78,6 @@ struct sout_access_out_sys_t {
 
 /* */
 
-#if LIBAVFORMAT_VERSION_MAJOR < 54
-static vlc_object_t *current_access = NULL;
-
-static int UrlInterruptCallbackSingle(void)
-{
-    return UrlInterruptCallback(current_access);
-}
-
-static int SetupAvioCb(vlc_object_t *access)
-{
-    static vlc_mutex_t avio_lock = VLC_STATIC_MUTEX;
-    vlc_mutex_lock(&avio_lock);
-    assert(!access != !current_access);
-    if (access && current_access) {
-        vlc_mutex_unlock(&avio_lock);
-        return VLC_EGENERIC;
-    }
-    url_set_interrupt_cb(access ? UrlInterruptCallbackSingle : NULL);
-
-    current_access = access;
-
-    vlc_mutex_unlock(&avio_lock);
-
-    return VLC_SUCCESS;
-}
-#endif
-
 /* */
 
 int OpenAvio(vlc_object_t *object)
@@ -147,9 +106,6 @@ int OpenAvio(vlc_object_t *object)
     vlc_init_avformat(object);
 
     int ret;
-#if LIBAVFORMAT_VERSION_MAJOR < 54
-    ret = avio_open(&sys->context, url, AVIO_FLAG_READ);
-#else
     AVIOInterruptCB cb = {
         .callback = UrlInterruptCallback,
         .opaque = access,
@@ -165,7 +121,6 @@ int OpenAvio(vlc_object_t *object)
     while ((t = av_dict_get(options, "", t, AV_DICT_IGNORE_SUFFIX)))
         msg_Err( access, "unknown option \"%s\"", t->key );
     av_dict_free(&options);
-#endif
     if (ret < 0) {
         msg_Err(access, "Failed to open %s: %s", url,
                 vlc_strerror_c(AVUNERROR(ret)));
@@ -174,22 +129,9 @@ int OpenAvio(vlc_object_t *object)
     }
     free(url);
 
-#if LIBAVFORMAT_VERSION_MAJOR < 54
-    /* We can accept only one active user at any time */
-    if (SetupAvioCb(VLC_OBJECT(access))) {
-        msg_Err(access, "Module already in use");
-        avio_close(sys->context);
-        return VLC_EGENERIC;
-    }
-#endif
-
     int64_t size = avio_size(sys->context);
     bool seekable;
-#if LIBAVFORMAT_VERSION_MAJOR < 54
-    seekable = !sys->context->is_streamed;
-#else
     seekable = sys->context->seekable;
-#endif
     msg_Dbg(access, "%sseekable, size=%"PRIi64, seekable ? "" : "not ", size);
 
     /* */
@@ -227,9 +169,6 @@ int OutOpenAvio(vlc_object_t *object)
         return VLC_EGENERIC;
 
     int ret;
-#if LIBAVFORMAT_VERSION_MAJOR < 54
-    ret = avio_open(&sys->context, access->psz_path, AVIO_FLAG_WRITE);
-#else
     AVDictionary *options = NULL;
     char *psz_opts = var_InheritString(access, "sout-avio-options");
     if (psz_opts) {
@@ -242,21 +181,12 @@ int OutOpenAvio(vlc_object_t *object)
     while ((t = av_dict_get(options, "", t, AV_DICT_IGNORE_SUFFIX)))
         msg_Err( access, "unknown option \"%s\"", t->key );
     av_dict_free(&options);
-#endif
     if (ret < 0) {
         errno = AVUNERROR(ret);
         msg_Err(access, "Failed to open %s", access->psz_path);
         return VLC_EGENERIC;
     }
 
-#if LIBAVFORMAT_VERSION_MAJOR < 54
-    /* We can accept only one active user at any time */
-    if (SetupAvioCb(VLC_OBJECT(access))) {
-        msg_Err(access, "Module already in use");
-        return VLC_EGENERIC;
-    }
-#endif
-
     access->pf_write = Write;
     access->pf_control = OutControl;
     access->pf_seek = OutSeek;
@@ -270,10 +200,6 @@ void CloseAvio(vlc_object_t *object)
     access_t *access = (access_t*)object;
     access_sys_t *sys = access->p_sys;
 
-#if LIBAVFORMAT_VERSION_MAJOR < 54
-    SetupAvioCb(NULL);
-#endif
-
     avio_close(sys->context);
 }
 
@@ -282,10 +208,6 @@ void OutCloseAvio(vlc_object_t *object)
     sout_access_out_t *access = (sout_access_out_t*)object;
     sout_access_out_sys_t *sys = access->p_sys;
 
-#if LIBAVFORMAT_VERSION_MAJOR < 54
-    SetupAvioCb(NULL);
-#endif
-
     avio_close(sys->context);
 }
 
@@ -311,12 +233,6 @@ static ssize_t Write(sout_access_out_t *p_access, block_t *p_buffer)
     while (p_buffer != NULL) {
         block_t *p_next = p_buffer->p_next;
 
-#if LIBAVFORMAT_VERSION_MAJOR < 54
-        val = url_write(p_sys->context, p_buffer->p_buffer, p_buffer->i_buffer);
-        if (val < 0)
-            goto error;
-        i_write += val;
-#else
         avio_write(p_sys->context, p_buffer->p_buffer, p_buffer->i_buffer);
         avio_flush(p_sys->context);
         if ((val = p_sys->context->error) != 0) {
@@ -324,7 +240,6 @@ static ssize_t Write(sout_access_out_t *p_access, block_t *p_buffer)
             goto error;
         }
         i_write += p_buffer->i_buffer;
-#endif
 
         block_Release(p_buffer);
 
@@ -399,19 +314,11 @@ static int Control(access_t *access, int query, va_list args)
     case STREAM_CAN_SEEK:
     case STREAM_CAN_FASTSEEK: /* FIXME how to do that ? */
         b = va_arg(args, bool *);
-#if LIBAVFORMAT_VERSION_MAJOR < 54
-        *b = !sys->context->is_streamed;
-#else
         *b = sys->context->seekable;
-#endif
         return VLC_SUCCESS;
     case STREAM_CAN_PAUSE:
         b = va_arg(args, bool *);
-#if LIBAVFORMAT_VERSION_MAJOR < 54
-        *b = sys->context->prot->url_read_pause != NULL;
-#else
         *b = sys->context->read_pause != NULL;
-#endif
         return VLC_SUCCESS;
     case STREAM_CAN_CONTROL_PACE:
         b = va_arg(args, bool *);



More information about the vlc-commits mailing list