You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-11-23 21:54:53 +02:00
mmsh: reimplement seeking
Fixes Ticket2682 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
@@ -309,16 +309,14 @@ static int mmsh_open_internal(URLContext *h, const char *uri, int flags, int tim
|
|||||||
return 0;
|
return 0;
|
||||||
fail:
|
fail:
|
||||||
av_freep(&stream_selection);
|
av_freep(&stream_selection);
|
||||||
|
mmsh_close(h);
|
||||||
av_dlog(NULL, "Connection failed with error %d\n", err);
|
av_dlog(NULL, "Connection failed with error %d\n", err);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mmsh_open(URLContext *h, const char *uri, int flags)
|
static int mmsh_open(URLContext *h, const char *uri, int flags)
|
||||||
{
|
{
|
||||||
int ret = mmsh_open_internal(h, uri, flags, 0, 0);
|
return mmsh_open_internal(h, uri, flags, 0, 0);
|
||||||
if (ret < 0)
|
|
||||||
mmsh_close(h);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int handle_chunk_type(MMSHContext *mmsh)
|
static int handle_chunk_type(MMSHContext *mmsh)
|
||||||
@@ -370,23 +368,26 @@ static int mmsh_read(URLContext *h, uint8_t *buf, int size)
|
|||||||
static int64_t mmsh_read_seek(URLContext *h, int stream_index,
|
static int64_t mmsh_read_seek(URLContext *h, int stream_index,
|
||||||
int64_t timestamp, int flags)
|
int64_t timestamp, int flags)
|
||||||
{
|
{
|
||||||
MMSHContext *mmsh = h->priv_data;
|
MMSHContext *mmsh_old = h->priv_data;
|
||||||
MMSContext *mms = &mmsh->mms;
|
MMSHContext *mmsh = av_mallocz(sizeof(*mmsh));
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret= mmsh_open_internal(h, mmsh->location, 0, FFMAX(timestamp, 0), 0);
|
if (!mmsh)
|
||||||
|
return AVERROR(ENOMEM);
|
||||||
|
|
||||||
if(ret>=0){
|
|
||||||
if (mms->mms_hd)
|
|
||||||
ffurl_close(mms->mms_hd);
|
|
||||||
av_freep(&mms->streams);
|
|
||||||
av_freep(&mms->asf_header);
|
|
||||||
av_free(mmsh);
|
|
||||||
mmsh = h->priv_data;
|
|
||||||
mms = &mmsh->mms;
|
|
||||||
mms->asf_header_read_size= mms->asf_header_size;
|
|
||||||
}else
|
|
||||||
h->priv_data = mmsh;
|
h->priv_data = mmsh;
|
||||||
|
ret= mmsh_open_internal(h, mmsh_old->location, 0, FFMAX(timestamp, 0), 0);
|
||||||
|
if(ret>=0){
|
||||||
|
h->priv_data = mmsh_old;
|
||||||
|
mmsh_close(h);
|
||||||
|
h->priv_data = mmsh;
|
||||||
|
av_free(mmsh_old);
|
||||||
|
mmsh->mms.asf_header_read_size = mmsh->mms.asf_header_size;
|
||||||
|
}else {
|
||||||
|
h->priv_data = mmsh_old;
|
||||||
|
av_free(mmsh);
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user