diff options
Diffstat (limited to 'demux')
-rw-r--r-- | demux/demux.c | 70 | ||||
-rw-r--r-- | demux/demux.h | 3 | ||||
-rw-r--r-- | demux/demux_rawaudio.c | 1 | ||||
-rw-r--r-- | demux/stheader.h | 4 |
4 files changed, 0 insertions, 78 deletions
diff --git a/demux/demux.c b/demux/demux.c index 3f5851e5b6..9d02abc8f1 100644 --- a/demux/demux.c +++ b/demux/demux.c @@ -46,8 +46,6 @@ #error MP_INPUT_BUFFER_PADDING_SIZE is too small! #endif -static void clear_parser(sh_audio_t *sh); - // Demuxer list extern const struct demuxer_desc demuxer_desc_edl; extern const struct demuxer_desc demuxer_desc_cue; @@ -370,7 +368,6 @@ static void free_sh_audio(demuxer_t *demuxer, int id) mp_msg(MSGT_DEMUXER, MSGL_DBG2, "DEMUXER: freeing sh_audio at %p\n", sh); free(sh->wf); free(sh->codecdata); - clear_parser(sh); free_sh_stream(sh->gsh); } @@ -467,73 +464,6 @@ void ds_add_packet(demux_stream_t *ds, demux_packet_t *dp) ds->demuxer->video->packs); } -static void allocate_parser(AVCodecContext **avctx, AVCodecParserContext **parser, const char *format) -{ - enum AVCodecID codec_id = mp_codec_to_av_codec_id(format); - - switch (codec_id) { - case AV_CODEC_ID_AAC_LATM: - case AV_CODEC_ID_AC3: - case AV_CODEC_ID_EAC3: - case AV_CODEC_ID_DTS: - case AV_CODEC_ID_FLAC: - case AV_CODEC_ID_MLP: - case AV_CODEC_ID_MP3: - case AV_CODEC_ID_MP2: - case AV_CODEC_ID_TRUEHD: - *avctx = avcodec_alloc_context3(NULL); - if (!*avctx) - return; - *parser = av_parser_init(codec_id); - if (!*parser) - av_freep(avctx); - break; - default: ; - } -} - -static void get_parser(sh_audio_t *sh, AVCodecContext **avctx, AVCodecParserContext **parser) -{ - *avctx = NULL; - *parser = NULL; - - if (!sh || !sh->needs_parsing) - return; - - *avctx = sh->avctx; - *parser = sh->parser; - if (*parser) - return; - - allocate_parser(avctx, parser, sh->gsh->codec); - sh->avctx = *avctx; - sh->parser = *parser; -} - -int ds_parse(demux_stream_t *ds, uint8_t **buffer, int *len, double pts, int64_t pos) -{ - AVCodecContext *avctx; - AVCodecParserContext *parser; - get_parser(ds->sh, &avctx, &parser); - if (!parser) - return *len; - return av_parser_parse2(parser, avctx, buffer, len, *buffer, *len, pts, pts, pos); -} - -static void clear_parser(sh_audio_t *sh) -{ - av_parser_close(sh->parser); - sh->parser = NULL; - av_freep(&sh->avctx); -} - -void ds_clear_parser(demux_stream_t *ds) -{ - if (!ds->sh) - return; - clear_parser(ds->sh); -} - void ds_read_packet(demux_stream_t *ds, stream_t *stream, int len, double pts, int64_t pos, bool keyframe) { diff --git a/demux/demux.h b/demux/demux.h index df73ddd4ee..a478e58409 100644 --- a/demux/demux.h +++ b/demux/demux.h @@ -292,9 +292,6 @@ int ds_get_packet_pts(struct demux_stream *ds, unsigned char **start, struct demux_packet *ds_get_packet_sub(demux_stream_t *ds); struct demux_packet *ds_get_packet2(struct demux_stream *ds, bool repeat_last); double ds_get_next_pts(struct demux_stream *ds); -int ds_parse(struct demux_stream *sh, uint8_t **buffer, int *len, double pts, - int64_t pos); -void ds_clear_parser(struct demux_stream *sh); struct demuxer *demux_open(struct MPOpts *opts, struct stream *stream, int file_format, int aid, int vid, int sid, diff --git a/demux/demux_rawaudio.c b/demux/demux_rawaudio.c index 3cd2500e03..b680a77888 100644 --- a/demux/demux_rawaudio.c +++ b/demux/demux_rawaudio.c @@ -70,7 +70,6 @@ static demuxer_t* demux_rawaudio_open(demuxer_t* demuxer) { demuxer->audio->id = 0; demuxer->audio->sh = sh_audio; sh_audio->ds = demuxer->audio; - sh_audio->needs_parsing = 1; return demuxer; } diff --git a/demux/stheader.h b/demux/stheader.h index 475d063637..511e959c30 100644 --- a/demux/stheader.h +++ b/demux/stheader.h @@ -117,10 +117,6 @@ typedef struct sh_audio { unsigned char *codecdata; int codecdata_len; int pts_bytes; // bytes output by decoder after last known pts - /* things needed for parsing */ - bool needs_parsing; - struct AVCodecContext *avctx; - struct AVCodecParserContext *parser; } sh_audio_t; typedef struct sh_video { |