[vlc-devel] [PATCH 1/2] demux: Implement legacy fallbacks in the modules

Hugo Beauzée-Luyssen hugo at beauzee.fr
Tue Jan 16 14:11:54 CET 2018


This is a pre-requisite to revert
a2beb67ed706e299010c28d8733e2c0123b57168
---
 modules/demux/aiff.c           |  8 ++++++++
 modules/demux/avformat/demux.c |  6 +++++-
 modules/demux/avi/avi.c        |  6 ++++++
 modules/demux/caf.c            |  7 +++++++
 modules/demux/gme.c            |  9 +++++++++
 modules/demux/image.c          |  9 +++++++++
 modules/demux/mkv/mkv.cpp      |  7 +++++++
 modules/demux/mod.c            |  9 +++++++++
 modules/demux/mp4/mp4.c        |  7 +++++++
 modules/demux/mpc.c            |  6 ++++++
 modules/demux/mpeg/ps.c        |  9 +++++++++
 modules/demux/mpeg/ts.c        |  6 ++++++
 modules/demux/nsv.c            |  8 ++++++++
 modules/demux/nuv.c            |  8 ++++++++
 modules/demux/pva.c            |  6 ++++++
 modules/demux/real.c           | 13 ++++++++++---
 modules/demux/sid.cpp          |  7 +++++++
 modules/demux/smf.c            |  7 +++++++
 modules/demux/stl.c            |  6 ++++++
 modules/demux/subtitle.c       |  5 +++++
 modules/demux/tta.c            |  7 +++++++
 modules/demux/ttml.c           |  5 +++++
 modules/demux/ty.c             |  5 +++++
 modules/demux/vobsub.c         |  5 +++++
 modules/demux/webvtt.c         |  5 +++++
 25 files changed, 172 insertions(+), 4 deletions(-)

diff --git a/modules/demux/aiff.c b/modules/demux/aiff.c
index e87d216098..aa460b77c8 100644
--- a/modules/demux/aiff.c
+++ b/modules/demux/aiff.c
@@ -344,6 +344,14 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
         }
         case DEMUX_SET_TIME:
         case DEMUX_GET_FPS:
+            return VLC_EGENERIC;
+
+        case DEMUX_CAN_PAUSE:
+        case DEMUX_SET_PAUSE_STATE:
+        case DEMUX_CAN_CONTROL_PACE:
+        case DEMUX_GET_PTS_DELAY:
+             return demux_vaControlHelper( p_demux->s, 0, -1, 0, 1, i_query, args );
+
         default:
             return VLC_EGENERIC;
     }
diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c
index 25049650cf..7074152918 100644
--- a/modules/demux/avformat/demux.c
+++ b/modules/demux/avformat/demux.c
@@ -1167,7 +1167,11 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
                 return VLC_EGENERIC;
             *va_arg( args, int * ) = p_sys->i_seekpoint;
             return VLC_SUCCESS;
-
+        case DEMUX_CAN_PAUSE:
+        case DEMUX_SET_PAUSE_STATE:
+        case DEMUX_CAN_CONTROL_PACE:
+        case DEMUX_GET_PTS_DELAY:
+            return demux_vaControlHelper( p_demux->s, 0, -1, 0, 1, i_query, args );
         default:
             return VLC_EGENERIC;
     }
diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c
index 7bfbd3367b..a2beba6e17 100644
--- a/modules/demux/avi/avi.c
+++ b/modules/demux/avi/avi.c
@@ -1792,6 +1792,12 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
             return VLC_EGENERIC;
         }
 
+        case DEMUX_CAN_PAUSE:
+        case DEMUX_SET_PAUSE_STATE:
+        case DEMUX_CAN_CONTROL_PACE:
+        case DEMUX_GET_PTS_DELAY:
+            return demux_vaControlHelper( p_demux->s, 0, -1, 0, 1, i_query, args );
+
         default:
             return VLC_EGENERIC;
     }
diff --git a/modules/demux/caf.c b/modules/demux/caf.c
index cce8e93afb..3ff422f6fb 100644
--- a/modules/demux/caf.c
+++ b/modules/demux/caf.c
@@ -1046,6 +1046,13 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
         case DEMUX_GET_META:
             return vlc_stream_Control( p_demux->s, STREAM_GET_META, args );
 
+        case DEMUX_CAN_PAUSE:
+        case DEMUX_SET_PAUSE_STATE:
+        case DEMUX_CAN_CONTROL_PACE:
+        case DEMUX_GET_PTS_DELAY:
+            return demux_vaControlHelper( p_demux->s, p_sys->i_data_offset,
+                                          p_sys->i_data_size, 0, 1, i_query, args );
+
         default:
             return VLC_EGENERIC;
     }
diff --git a/modules/demux/gme.c b/modules/demux/gme.c
index d89ac815cf..368c583b8e 100644
--- a/modules/demux/gme.c
+++ b/modules/demux/gme.c
@@ -333,6 +333,15 @@ static int Control (demux_t *demux, int query, va_list args)
         case DEMUX_GET_TITLE:
             *va_arg(args, int *) = sys->track_id;
             return VLC_SUCCESS;
+
+        case DEMUX_CAN_PAUSE:
+        case DEMUX_SET_PAUSE_STATE:
+        case DEMUX_CAN_CONTROL_PACE:
+        case DEMUX_GET_PTS_DELAY:
+            return demux_vaControlHelper( demux->s, 0, -1, 0, 1, query, args );
+
+        default:
+            return VLC_EGENERIC;
     }
 
     return VLC_EGENERIC;
diff --git a/modules/demux/image.c b/modules/demux/image.c
index 90cfc3ccb4..038cf5e43f 100644
--- a/modules/demux/image.c
+++ b/modules/demux/image.c
@@ -283,8 +283,17 @@ static int Control(demux_t *demux, int query, va_list args)
     case DEMUX_GET_META:
     case DEMUX_HAS_UNSUPPORTED_META:
     case DEMUX_GET_ATTACHMENTS:
+        return VLC_EGENERIC;
+
+    case DEMUX_CAN_PAUSE:
+    case DEMUX_SET_PAUSE_STATE:
+    case DEMUX_CAN_CONTROL_PACE:
+    case DEMUX_GET_PTS_DELAY:
+        return demux_vaControlHelper( demux->s, 0, -1, 0, 1, query, args );
+
     default:
         return VLC_EGENERIC;
+
     }
 }
 
diff --git a/modules/demux/mkv/mkv.cpp b/modules/demux/mkv/mkv.cpp
index 99967c67aa..f32fff1d05 100644
--- a/modules/demux/mkv/mkv.cpp
+++ b/modules/demux/mkv/mkv.cpp
@@ -459,6 +459,13 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
             b = va_arg( args, int ); /* precise? */
             msg_Dbg(p_demux,"SET_TIME to %" PRId64, i64 );
             return Seek( p_demux, i64, -1, NULL, b );
+
+        case DEMUX_CAN_PAUSE:
+        case DEMUX_SET_PAUSE_STATE:
+        case DEMUX_CAN_CONTROL_PACE:
+        case DEMUX_GET_PTS_DELAY:
+            return demux_vaControlHelper( p_demux->s, 0, -1, 0, 1, i_query, args );
+
         default:
             return VLC_EGENERIC;
     }
diff --git a/modules/demux/mod.c b/modules/demux/mod.c
index 46614e5a82..eb513aba3d 100644
--- a/modules/demux/mod.c
+++ b/modules/demux/mod.c
@@ -428,8 +428,17 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
     }
 
     case DEMUX_GET_FPS: /* meaningless */
+        return VLC_EGENERIC;
+
+    case DEMUX_CAN_PAUSE:
+    case DEMUX_CAN_CONTROL_PACE:
+    case DEMUX_GET_PTS_DELAY:
+    case DEMUX_SET_PAUSE_STATE:
+        return demux_vaControlHelper( p_demux->s, 0, -1, 0, 1, i_query, args );
+
     default:
         return VLC_EGENERIC;
+
     }
 }
 
diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c
index 26867fc90a..7a4ecb54eb 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -2139,6 +2139,13 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
         case DEMUX_SET_GROUP:
         case DEMUX_HAS_UNSUPPORTED_META:
         case DEMUX_CAN_RECORD:
+            return VLC_EGENERIC;
+
+        case DEMUX_CAN_PAUSE:
+        case DEMUX_SET_PAUSE_STATE:
+        case DEMUX_CAN_CONTROL_PACE:
+            return demux_vaControlHelper( p_demux->s, 0, -1, 0, 1, i_query, args );
+
         default:
             return VLC_EGENERIC;
     }
diff --git a/modules/demux/mpc.c b/modules/demux/mpc.c
index f8648b7b85..1635b8874f 100644
--- a/modules/demux/mpc.c
+++ b/modules/demux/mpc.c
@@ -387,6 +387,12 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
             }
             return VLC_EGENERIC;
 
+        case DEMUX_CAN_PAUSE:
+        case DEMUX_SET_PAUSE_STATE:
+        case DEMUX_CAN_CONTROL_PACE:
+        case DEMUX_GET_PTS_DELAY:
+            return demux_vaControlHelper( p_demux->s, 0, -1, 0, 1, i_query, args );
+
         default:
             return VLC_EGENERIC;
     }
diff --git a/modules/demux/mpeg/ps.c b/modules/demux/mpeg/ps.c
index f4ef17dba5..f94c96e626 100644
--- a/modules/demux/mpeg/ps.c
+++ b/modules/demux/mpeg/ps.c
@@ -785,8 +785,17 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
             return vlc_stream_vaControl( p_demux->s, STREAM_GET_META, args );
 
         case DEMUX_GET_FPS:
+            break;
+
+        case DEMUX_CAN_PAUSE:
+        case DEMUX_SET_PAUSE_STATE:
+        case DEMUX_CAN_CONTROL_PACE:
+        case DEMUX_GET_PTS_DELAY:
+            return demux_vaControlHelper( p_demux->s, 0, -1, 0, 1, i_query, args );
+
         default:
             break;
+
     }
     return VLC_EGENERIC;
 }
diff --git a/modules/demux/mpeg/ts.c b/modules/demux/mpeg/ts.c
index f36bdce077..5d5f24fb27 100644
--- a/modules/demux/mpeg/ts.c
+++ b/modules/demux/mpeg/ts.c
@@ -1175,6 +1175,12 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
         return VLC_SUCCESS;
     }
 
+    case DEMUX_CAN_PAUSE:
+    case DEMUX_SET_PAUSE_STATE:
+    case DEMUX_CAN_CONTROL_PACE:
+    case DEMUX_GET_PTS_DELAY:
+        return demux_vaControlHelper( p_demux->s, 0, -1, 0, 1, i_query, args );
+
     default:
         break;
     }
diff --git a/modules/demux/nsv.c b/modules/demux/nsv.c
index 5fb0bc93c0..ebb9097d20 100644
--- a/modules/demux/nsv.c
+++ b/modules/demux/nsv.c
@@ -417,6 +417,14 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
 
 
         case DEMUX_SET_TIME:
+            return VLC_EGENERIC;
+
+        case DEMUX_CAN_PAUSE:
+        case DEMUX_SET_PAUSE_STATE:
+        case DEMUX_CAN_CONTROL_PACE:
+        case DEMUX_GET_PTS_DELAY:
+            return demux_vaControlHelper( p_demux->s, 0, -1, 0, 1, i_query, args );
+
         default:
             return VLC_EGENERIC;
     }
diff --git a/modules/demux/nuv.c b/modules/demux/nuv.c
index 33355d89c0..40f7b4b60a 100644
--- a/modules/demux/nuv.c
+++ b/modules/demux/nuv.c
@@ -545,6 +545,14 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
             return VLC_SUCCESS;
 
         case DEMUX_GET_META:
+            return VLC_EGENERIC;
+
+        case DEMUX_CAN_PAUSE:
+        case DEMUX_SET_PAUSE_STATE:
+        case DEMUX_CAN_CONTROL_PACE:
+        case DEMUX_GET_PTS_DELAY:
+            return demux_vaControlHelper( p_demux->s, 0, -1, 0, 1, i_query, args );
+
         default:
             return VLC_EGENERIC;
 
diff --git a/modules/demux/pva.c b/modules/demux/pva.c
index 7b52249a21..8eb52924f4 100644
--- a/modules/demux/pva.c
+++ b/modules/demux/pva.c
@@ -346,6 +346,12 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
             *pf = (double)1000000.0 / (double)p_sys->i_pcr_inc;
             return VLC_SUCCESS;
 #endif
+        case DEMUX_CAN_PAUSE:
+        case DEMUX_SET_PAUSE_STATE:
+        case DEMUX_CAN_CONTROL_PACE:
+        case DEMUX_GET_PTS_DELAY:
+            return demux_vaControlHelper( p_demux->s, 0, -1, 0, 1, i_query, args );
+
         case DEMUX_SET_TIME:
         default:
             return VLC_EGENERIC;
diff --git a/modules/demux/real.c b/modules/demux/real.c
index 72dba3b099..9cf2bbda13 100644
--- a/modules/demux/real.c
+++ b/modules/demux/real.c
@@ -390,7 +390,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
         case DEMUX_GET_POSITION:
             pf = va_arg( args, double * );
 
-            /* read stream size maybe failed in rtsp streaming, 
+            /* read stream size maybe failed in rtsp streaming,
                so use duration to determin the position at first  */
             if( p_sys->i_our_duration > 0 )
             {
@@ -457,7 +457,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
 
         case DEMUX_GET_LENGTH:
             pi64 = va_arg( args, int64_t * );
- 
+
             if( p_sys->i_our_duration <= 0 )
             {
                 *pi64 = 0;
@@ -485,6 +485,13 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
             return VLC_SUCCESS;
         }
 
+        case DEMUX_CAN_PAUSE:
+        case DEMUX_SET_PAUSE_STATE:
+        case DEMUX_CAN_CONTROL_PACE:
+        case DEMUX_GET_PTS_DELAY:
+            return demux_vaControlHelper( p_demux->s, p_sys->i_data_offset,
+                                          p_sys->i_data_size, 0, 1, i_query, args );
+
         case DEMUX_GET_FPS:
         default:
             return VLC_EGENERIC;
@@ -1252,7 +1259,7 @@ static void HeaderINDX( demux_t *p_demux )
         }
 
         real_index_t *p_idx = &p_sys->p_index[i];
-        
+
         p_idx->i_time_offset = GetDWBE( &p_entry[2] );
         p_idx->i_file_offset = GetDWBE( &p_entry[6] );
         p_idx->i_frame_index = GetDWBE( &p_entry[10] );
diff --git a/modules/demux/sid.cpp b/modules/demux/sid.cpp
index eab6976e23..f62138e37b 100644
--- a/modules/demux/sid.cpp
+++ b/modules/demux/sid.cpp
@@ -288,6 +288,13 @@ static int Control (demux_t *demux, int query, va_list args)
         case DEMUX_GET_TITLE:
             *va_arg(args, int *) = sys->last_title;
             return VLC_SUCCESS;
+
+        case DEMUX_CAN_PAUSE:
+        case DEMUX_SET_PAUSE_STATE:
+        case DEMUX_CAN_CONTROL_PACE:
+        case DEMUX_GET_PTS_DELAY:
+            return demux_vaControlHelper( demux->s, 0, -1, 0,
+                                          sys->bytes_per_frame, query, args );
     }
 
     return VLC_EGENERIC;
diff --git a/modules/demux/smf.c b/modules/demux/smf.c
index 7da895f2d6..cc977fc35e 100644
--- a/modules/demux/smf.c
+++ b/modules/demux/smf.c
@@ -524,6 +524,13 @@ static int Control (demux_t *demux, int i_query, va_list args)
             break;
         case DEMUX_SET_TIME:
             return Seek (demux, va_arg (args, int64_t));
+
+        case DEMUX_CAN_PAUSE:
+        case DEMUX_SET_PAUSE_STATE:
+        case DEMUX_CAN_CONTROL_PACE:
+        case DEMUX_GET_PTS_DELAY:
+            return demux_vaControlHelper( demux->s, 0, -1, 0, 1, i_query, args );
+
         default:
             return VLC_EGENERIC;
     }
diff --git a/modules/demux/stl.c b/modules/demux/stl.c
index 238b515cc6..18b07e9d66 100644
--- a/modules/demux/stl.c
+++ b/modules/demux/stl.c
@@ -162,6 +162,12 @@ static int Control(demux_t *demux, int query, va_list args)
         }
         return VLC_SUCCESS;
     }
+    case DEMUX_CAN_PAUSE:
+    case DEMUX_SET_PAUSE_STATE:
+    case DEMUX_CAN_CONTROL_PACE:
+    case DEMUX_GET_PTS_DELAY: {
+        return demux_vaControlHelper( demux->s, 0, -1, 0, 1, query, args );
+    }
     default:
         break;
     }
diff --git a/modules/demux/subtitle.c b/modules/demux/subtitle.c
index 87f548290a..f5320e6ca6 100644
--- a/modules/demux/subtitle.c
+++ b/modules/demux/subtitle.c
@@ -830,6 +830,11 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
             p_sys->i_next_demux_date = va_arg( args, int64_t ) - VLC_TS_0;
             return VLC_SUCCESS;
 
+        case DEMUX_CAN_PAUSE:
+        case DEMUX_SET_PAUSE_STATE:
+        case DEMUX_CAN_CONTROL_PACE:
+            return demux_vaControlHelper( p_demux->s, 0, -1, 0, 1, i_query, args );
+
         case DEMUX_GET_PTS_DELAY:
         case DEMUX_GET_FPS:
         case DEMUX_GET_META:
diff --git a/modules/demux/tta.c b/modules/demux/tta.c
index 2da7460cc9..83878b3543 100644
--- a/modules/demux/tta.c
+++ b/modules/demux/tta.c
@@ -273,6 +273,13 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
             *pi64 = INT64_C(1000000) * p_sys->i_currentframe * TTA_FRAMETIME;
             return VLC_SUCCESS;
 
+        case DEMUX_CAN_PAUSE:
+        case DEMUX_SET_PAUSE_STATE:
+        case DEMUX_CAN_CONTROL_PACE:
+        case DEMUX_GET_PTS_DELAY:
+            return demux_vaControlHelper( p_demux->s, 0, p_sys->i_datalength,
+                                          0, p_sys->i_framelength, i_query, args );
+
         default:
             return VLC_EGENERIC;
     }
diff --git a/modules/demux/ttml.c b/modules/demux/ttml.c
index d4d0755e9f..ce6f499efb 100644
--- a/modules/demux/ttml.c
+++ b/modules/demux/ttml.c
@@ -277,6 +277,11 @@ static int Control( demux_t* p_demux, int i_query, va_list args )
                 return VLC_SUCCESS;
             }
             break;
+        case DEMUX_CAN_PAUSE:
+        case DEMUX_SET_PAUSE_STATE:
+        case DEMUX_CAN_CONTROL_PACE:
+            return demux_vaControlHelper( p_demux->s, 0, -1, 0, 1, i_query, args );
+
         case DEMUX_GET_PTS_DELAY:
         case DEMUX_GET_FPS:
         case DEMUX_GET_META:
diff --git a/modules/demux/ty.c b/modules/demux/ty.c
index bbe45ea2b0..b08217564e 100644
--- a/modules/demux/ty.c
+++ b/modules/demux/ty.c
@@ -533,6 +533,11 @@ static int Control(demux_t *p_demux, int i_query, va_list args)
     case DEMUX_SET_TIME:      /* arg is time in microsecs */
         i64 = va_arg( args, int64_t );
         return ty_stream_seek_time(p_demux, i64 * 1000);
+    case DEMUX_CAN_PAUSE:
+    case DEMUX_SET_PAUSE_STATE:
+    case DEMUX_CAN_CONTROL_PACE:
+    case DEMUX_GET_PTS_DELAY:
+        return demux_vaControlHelper( p_demux->s, 0, -1, 0, 1, i_query, args );
     case DEMUX_GET_FPS:
     default:
         return VLC_EGENERIC;
diff --git a/modules/demux/vobsub.c b/modules/demux/vobsub.c
index 8a832ff3bd..3f1257633d 100644
--- a/modules/demux/vobsub.c
+++ b/modules/demux/vobsub.c
@@ -330,6 +330,11 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
             p_sys->i_next_demux_date = va_arg( args, int64_t );
             return VLC_SUCCESS;
 
+        case DEMUX_CAN_PAUSE:
+        case DEMUX_SET_PAUSE_STATE:
+        case DEMUX_CAN_CONTROL_PACE:
+            return demux_vaControlHelper( p_demux->s, 0, -1, 0, 1, i_query, args );
+
         case DEMUX_GET_PTS_DELAY:
         case DEMUX_GET_FPS:
         case DEMUX_GET_META:
diff --git a/modules/demux/webvtt.c b/modules/demux/webvtt.c
index 40eda6b294..1b95a5c0cc 100644
--- a/modules/demux/webvtt.c
+++ b/modules/demux/webvtt.c
@@ -481,6 +481,11 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
             p_sys->i_next_demux_time = va_arg( args, int64_t ) - VLC_TS_0;
             return VLC_SUCCESS;
 
+        case DEMUX_CAN_PAUSE:
+        case DEMUX_SET_PAUSE_STATE:
+        case DEMUX_CAN_CONTROL_PACE:
+            return demux_vaControlHelper( p_demux->s, 0, -1, 0, 1, i_query, args );
+
         case DEMUX_GET_PTS_DELAY:
         case DEMUX_GET_FPS:
         case DEMUX_GET_META:
-- 
2.11.0



More information about the vlc-devel mailing list