[FFmpeg-cvslog] r11273 - in trunk/libavformat: avio.c avio.h aviobuf.c utils.c

michael subversion
Wed Dec 19 21:57:13 CET 2007


Author: michael
Date: Wed Dec 19 21:57:13 2007
New Revision: 11273

Log:
Merge recently added and still unused play and pause functions.


Modified:
   trunk/libavformat/avio.c
   trunk/libavformat/avio.h
   trunk/libavformat/aviobuf.c
   trunk/libavformat/utils.c

Modified: trunk/libavformat/avio.c
==============================================================================
--- trunk/libavformat/avio.c	(original)
+++ trunk/libavformat/avio.c	Wed Dec 19 21:57:13 2007
@@ -192,18 +192,11 @@ void url_set_interrupt_cb(URLInterruptCB
     url_interrupt_cb = interrupt_cb;
 }
 
-int av_url_read_play(URLContext *h)
-{
-    if (!h->prot->url_read_play)
-        return AVERROR(ENOSYS);
-    return h->prot->url_read_play(h);
-}
-
-int av_url_read_pause(URLContext *h)
+int av_url_read_pause(URLContext *h, int pause)
 {
     if (!h->prot->url_read_pause)
         return AVERROR(ENOSYS);
-    return h->prot->url_read_pause(h);
+    return h->prot->url_read_pause(h, pause);
 }
 
 int av_url_read_seek(URLContext *h,

Modified: trunk/libavformat/avio.h
==============================================================================
--- trunk/libavformat/avio.h	(original)
+++ trunk/libavformat/avio.h	Wed Dec 19 21:57:13 2007
@@ -82,12 +82,12 @@ void url_set_interrupt_cb(URLInterruptCB
 /* not implemented */
 int url_poll(URLPollEntry *poll_table, int n, int timeout);
 
-/** Start playing or resume paused playout. Only meaningful if using a network
- * streaming protocol (e.g. MMS). */
-int av_url_read_play(URLContext *h);
-/** Pause playing - only meaningful if using a network streaming protocol
- * (e.g. MMS). */
-int av_url_read_pause(URLContext *h);
+/**
+ * Pause and resume playing - only meaningful if using a network streaming
+ * protocol (e.g. MMS).
+ * @param pause 1 for pause, 0 for resume
+ */
+int av_url_read_pause(URLContext *h, int pause);
 /**
  * Seek to a given timestamp relative to some component stream.
  * Only meaningful if using a network streaming protocol (e.g. MMS.)
@@ -123,8 +123,7 @@ typedef struct URLProtocol {
     offset_t (*url_seek)(URLContext *h, offset_t pos, int whence);
     int (*url_close)(URLContext *h);
     struct URLProtocol *next;
-    int (*url_read_play)(URLContext *h);
-    int (*url_read_pause)(URLContext *h);
+    int (*url_read_pause)(URLContext *h, int pause);
     int (*url_read_seek)(URLContext *h,
                          int stream_index, int64_t timestamp, int flags);
 } URLProtocol;
@@ -154,8 +153,7 @@ typedef struct {
     unsigned char *checksum_ptr;
     unsigned long (*update_checksum)(unsigned long checksum, const uint8_t *buf, unsigned int size);
     int error;         ///< contains the error code or 0 if no error happened
-    int (*read_play)(void *opaque);
-    int (*read_pause)(void *opaque);
+    int (*read_pause)(void *opaque, int pause);
     int (*read_seek)(void *opaque,
                      int stream_index, int64_t timestamp, int flags);
 } ByteIOContext;
@@ -190,8 +188,7 @@ offset_t url_fsize(ByteIOContext *s);
 int url_feof(ByteIOContext *s);
 int url_ferror(ByteIOContext *s);
 
-int av_url_read_fplay(ByteIOContext *h);
-int av_url_read_fpause(ByteIOContext *h);
+int av_url_read_fpause(ByteIOContext *h, int pause);
 int av_url_read_fseek(ByteIOContext *h,
                       int stream_index, int64_t timestamp, int flags);
 

Modified: trunk/libavformat/aviobuf.c
==============================================================================
--- trunk/libavformat/aviobuf.c	(original)
+++ trunk/libavformat/aviobuf.c	Wed Dec 19 21:57:13 2007
@@ -55,7 +55,6 @@ int init_put_byte(ByteIOContext *s,
         s->pos = buffer_size;
         s->buf_end = s->buffer + buffer_size;
     }
-    s->read_play  = NULL;
     s->read_pause = NULL;
     s->read_seek  = NULL;
     return 0;
@@ -532,8 +531,7 @@ int url_fdopen(ByteIOContext **s, URLCon
     (*s)->is_streamed = h->is_streamed;
     (*s)->max_packet_size = max_packet_size;
     if(h->prot) {
-        (*s)->read_play  = (int (*)(void *))h->prot->url_read_play;
-        (*s)->read_pause = (int (*)(void *))h->prot->url_read_pause;
+        (*s)->read_pause = (int (*)(void *, int))h->prot->url_read_pause;
         (*s)->read_seek  = (int (*)(void *, int, int64_t, int))h->prot->url_read_seek;
     }
     return 0;
@@ -641,18 +639,11 @@ int url_fget_max_packet_size(ByteIOConte
     return s->max_packet_size;
 }
 
-int av_url_read_fplay(ByteIOContext *s)
-{
-    if (!s->read_play)
-        return AVERROR(ENOSYS);
-    return s->read_play(s->opaque);
-}
-
-int av_url_read_fpause(ByteIOContext *s)
+int av_url_read_fpause(ByteIOContext *s, int pause)
 {
     if (!s->read_pause)
         return AVERROR(ENOSYS);
-    return s->read_pause(s->opaque);
+    return s->read_pause(s->opaque, pause);
 }
 
 int av_url_read_fseek(ByteIOContext *s,

Modified: trunk/libavformat/utils.c
==============================================================================
--- trunk/libavformat/utils.c	(original)
+++ trunk/libavformat/utils.c	Wed Dec 19 21:57:13 2007
@@ -2042,8 +2042,8 @@ int av_read_play(AVFormatContext *s)
 {
     if (s->iformat->read_play)
         return s->iformat->read_play(s);
-    if (s->pb && s->pb->read_play)
-        return av_url_read_fplay(s->pb);
+    if (s->pb && s->pb->read_pause)
+        return av_url_read_fpause(s->pb, 0);
     return AVERROR(ENOSYS);
 }
 
@@ -2052,7 +2052,7 @@ int av_read_pause(AVFormatContext *s)
     if (s->iformat->read_pause)
         return s->iformat->read_pause(s);
     if (s->pb && s->pb->read_pause)
-        return av_url_read_fpause(s->pb);
+        return av_url_read_fpause(s->pb, 1);
     return AVERROR(ENOSYS);
 }
 




More information about the ffmpeg-cvslog mailing list