[FFmpeg-soc] [soc]: r3809 - in dirac/libavcodec: dirac.c dirac.h diracdec.c

conrad subversion at mplayerhq.hu
Tue Nov 11 09:38:03 CET 2008


Author: conrad
Date: Tue Nov 11 09:38:03 2008
New Revision: 3809

Log:
Remove frame_rate from dirac_source_params and use time_base in AVCodecContext


Modified:
   dirac/libavcodec/dirac.c
   dirac/libavcodec/dirac.h
   dirac/libavcodec/diracdec.c

Modified: dirac/libavcodec/dirac.c
==============================================================================
--- dirac/libavcodec/dirac.c	(original)
+++ dirac/libavcodec/dirac.c	Tue Nov 11 09:38:03 2008
@@ -171,9 +171,10 @@ void dirac_dump_source_parameters(AVCode
 /**
  * Parse the source parameters in the sequence header.
  */
-static int parse_source_parameters(DiracContext *s)
+static int parse_source_parameters(AVCodecContext *avctx, DiracContext *s)
 {
     GetBitContext *gb = &s->gb;
+    AVRational frame_rate;
 
     /* Override the luma dimensions. */
     if (get_bits1(gb)) {
@@ -204,16 +205,18 @@ static int parse_source_parameters(Dirac
             return -1;
 
         if (! s->source.frame_rate_index) {
-            s->source.frame_rate.num = svq3_get_ue_golomb(gb);
-            s->source.frame_rate.den = svq3_get_ue_golomb(gb);
+            frame_rate.num = svq3_get_ue_golomb(gb);
+            frame_rate.den = svq3_get_ue_golomb(gb);
         }
     }
     if (s->source.frame_rate_index > 0 && s->source.frame_rate_index <= 10) {
         if (s->source.frame_rate_index <= 8)
-            s->source.frame_rate = ff_frame_rate_tab[s->source.frame_rate_index];
+            frame_rate = ff_frame_rate_tab[s->source.frame_rate_index];
         else
-            s->source.frame_rate = dirac_frame_rate[s->source.frame_rate_index-9];
+            frame_rate = dirac_frame_rate[s->source.frame_rate_index-9];
     }
+    av_reduce(&avctx->time_base.num, &avctx->time_base.den,
+              frame_rate.den, frame_rate.num, 1<<30);
 
     /* Override aspect ratio. */
     if (get_bits1(gb)) {
@@ -315,7 +318,7 @@ static int parse_source_parameters(Dirac
 /**
  * Parse the sequence header.
  */
-int ff_dirac_parse_sequence_header(DiracContext *s)
+int ff_dirac_parse_sequence_header(AVCodecContext *avctx, DiracContext *s)
 {
     GetBitContext *gb = &s->gb;
     unsigned int version_major;
@@ -347,7 +350,7 @@ int ff_dirac_parse_sequence_header(Dirac
     s->source = dirac_source_parameters_defaults[video_format];
 
     /* Override the defaults. */
-    if (parse_source_parameters(s))
+    if (parse_source_parameters(avctx, s))
         return -1;
 
     picture_coding_mode = svq3_get_ue_golomb(gb);

Modified: dirac/libavcodec/dirac.h
==============================================================================
--- dirac/libavcodec/dirac.h	(original)
+++ dirac/libavcodec/dirac.h	Tue Nov 11 09:38:03 2008
@@ -95,7 +95,6 @@ typedef struct {
     unsigned int luma_depth;
     unsigned int chroma_depth;
 
-    AVRational frame_rate;
     AVRational aspect_ratio;
 
     /* luma and chroma offsets */
@@ -576,6 +575,6 @@ int dirac_decode_frame(AVCodecContext *a
 
 void dirac_dump_source_parameters(AVCodecContext *avctx);
 
-int ff_dirac_parse_sequence_header(DiracContext *s);
+int ff_dirac_parse_sequence_header(AVCodecContext *avtx, DiracContext *s);
 
 #endif /* AVCODEC_DIRAC_H */

Modified: dirac/libavcodec/diracdec.c
==============================================================================
--- dirac/libavcodec/diracdec.c	(original)
+++ dirac/libavcodec/diracdec.c	Tue Nov 11 09:38:03 2008
@@ -856,7 +856,7 @@ int dirac_decode_frame(AVCodecContext *a
         s->avctx = avctx;
 
         if (parse_code ==  pc_seq_header) {
-            if (ff_dirac_parse_sequence_header(s))
+            if (ff_dirac_parse_sequence_header(avctx, s))
                 return -1;
 
             /* Dump the header. */



More information about the FFmpeg-soc mailing list