]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/dolby_e_parser.c
avcodec: Constify all the AVCodecParsers
[ffmpeg] / libavcodec / dolby_e_parser.c
index 2c116179063f9e1ffc11ff6867b094439d7d4961..8e187523f381b43d0da6ef1babec1ca4d38f5f99 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "parser.h"
-
 #include "dolby_e.h"
 #include "get_bits.h"
 #include "put_bits.h"
 
 typedef struct DBEParseContext {
-    ParseContext pc;
     DBEContext dectx;
-
-    DolbyEHeaderInfo metadata;
 } DBEParseContext;
 
 static int dolby_e_parse(AVCodecParserContext *s2, AVCodecContext *avctx,
@@ -39,14 +34,11 @@ static int dolby_e_parse(AVCodecParserContext *s2, AVCodecContext *avctx,
     DBEContext *s = &s1->dectx;
     int ret;
 
-    if ((ret = ff_dolby_e_parse_init(s, buf, buf_size)) < 0)
-        goto end;
-
-    if ((ret = ff_dolby_e_parse_header(s, &s1->metadata)) < 0)
+    if ((ret = ff_dolby_e_parse_header(s, buf, buf_size)) < 0)
         goto end;
 
     s2->duration = FRAME_SAMPLES;
-    switch (s1->metadata.nb_channels) {
+    switch (s->metadata.nb_channels) {
     case 4:
         avctx->channel_layout = AV_CH_LAYOUT_4POINT0;
         break;
@@ -58,8 +50,8 @@ static int dolby_e_parse(AVCodecParserContext *s2, AVCodecContext *avctx,
         break;
     }
 
-    avctx->channels    = s1->metadata.nb_channels;
-    avctx->sample_rate = sample_rate_tab[s1->metadata.fr_code];
+    avctx->channels    = s->metadata.nb_channels;
+    avctx->sample_rate = s->metadata.sample_rate;
     avctx->sample_fmt  = AV_SAMPLE_FMT_FLTP;
 
 end:
@@ -70,9 +62,8 @@ end:
     return buf_size;
 }
 
-AVCodecParser ff_dolby_e_parser = {
+const AVCodecParser ff_dolby_e_parser = {
     .codec_ids      = { AV_CODEC_ID_DOLBY_E },
     .priv_data_size = sizeof(DBEParseContext),
     .parser_parse   = dolby_e_parse,
-    .parser_close   = ff_parse_close,
 };