Mercurial > libavformat.hg
changeset 2839:b51319dd86e5 libavformat
Merge recently added and still unused play and pause functions.
author | michael |
---|---|
date | Wed, 19 Dec 2007 20:57:13 +0000 |
parents | 6bea49ef18b1 |
children | f51675f78402 |
files | avio.c avio.h aviobuf.c utils.c |
diffstat | 4 files changed, 17 insertions(+), 36 deletions(-) [+] |
line wrap: on
line diff
--- a/avio.c Wed Dec 19 16:00:08 2007 +0000 +++ b/avio.c Wed Dec 19 20:57:13 2007 +0000 @@ -192,18 +192,11 @@ 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,
--- a/avio.h Wed Dec 19 16:00:08 2007 +0000 +++ b/avio.h Wed Dec 19 20:57:13 2007 +0000 @@ -82,12 +82,12 @@ /* 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 @@ 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 @@ 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 @@ 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);
--- a/aviobuf.c Wed Dec 19 16:00:08 2007 +0000 +++ b/aviobuf.c Wed Dec 19 20:57:13 2007 +0000 @@ -55,7 +55,6 @@ 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 @@ (*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 @@ 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,
--- a/utils.c Wed Dec 19 16:00:08 2007 +0000 +++ b/utils.c Wed Dec 19 20:57:13 2007 +0000 @@ -2042,8 +2042,8 @@ { 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 @@ 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); }