~ubuntu-branches/ubuntu/raring/libav/raring-security

« back to all changes in this revision

Viewing changes to debian/patches/post-0.7.1/0014-gxf-Fix-25-fps-DV-material-in-GXF-being-misdetected-.patch

  • Committer: Package Import Robot
  • Author(s): Reinhard Tartler
  • Date: 2011-09-28 09:18:34 UTC
  • mfrom: (1.3.7 sid)
  • Revision ID: package-import@ubuntu.com-20110928091834-w415mnuh06h4zpvc
Tags: 4:0.7.1-7ubuntu2
Revert "Convert package to include multiarch support."

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
From c75ba07f6eb83439bc44e5504152f8ca03097bec Mon Sep 17 00:00:00 2001
 
2
From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= <tomas.hardin@codemill.se>
 
3
Date: Thu, 23 Jun 2011 15:59:33 +0200
 
4
Subject: [PATCH 14/70] gxf: Fix 25 fps DV material in GXF being misdetected as 50 fps
 
5
 
 
6
Set DV packet durations using fields_per_frame.
 
7
This requires turning gxf_stream_info into the demuxer's context for access to the value in gxf_packet().
 
8
Since MPEG-2 seems to work fine this done only for DV.
 
9
 
 
10
Signed-off-by: Anton Khirnov <anton@khirnov.net>
 
11
(cherry picked from commit 99fecc64b064a013559d3d61f7d9790e3c95c80e)
 
12
 
 
13
Signed-off-by: Anton Khirnov <anton@khirnov.net>
 
14
---
 
15
 libavformat/gxf.c |   25 ++++++++++++++++---------
 
16
 1 files changed, 16 insertions(+), 9 deletions(-)
 
17
 
 
18
diff --git a/libavformat/gxf.c b/libavformat/gxf.c
 
19
index 74d925f..d77fd18 100644
 
20
--- a/libavformat/gxf.c
 
21
+++ b/libavformat/gxf.c
 
22
@@ -264,7 +264,7 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) {
 
23
     int map_len;
 
24
     int len;
 
25
     AVRational main_timebase = {0, 0};
 
26
-    struct gxf_stream_info si;
 
27
+    struct gxf_stream_info *si = s->priv_data;
 
28
     int i;
 
29
     if (!parse_packet_header(pb, &pkt_type, &map_len) || pkt_type != PKT_MAP) {
 
30
         av_log(s, AV_LOG_ERROR, "map packet not found\n");
 
31
@@ -282,7 +282,7 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) {
 
32
         return 0;
 
33
     }
 
34
     map_len -= len;
 
35
-    gxf_material_tags(pb, &len, &si);
 
36
+    gxf_material_tags(pb, &len, si);
 
37
     avio_skip(pb, len);
 
38
     map_len -= 2;
 
39
     len = avio_rb16(pb); // length of track description
 
40
@@ -300,7 +300,7 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) {
 
41
         track_id = avio_r8(pb);
 
42
         track_len = avio_rb16(pb);
 
43
         len -= track_len;
 
44
-        gxf_track_tags(pb, &track_len, &si);
 
45
+        gxf_track_tags(pb, &track_len, si);
 
46
         avio_skip(pb, track_len);
 
47
         if (!(track_type & 0x80)) {
 
48
            av_log(s, AV_LOG_ERROR, "invalid track type %x\n", track_type);
 
49
@@ -316,12 +316,12 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) {
 
50
         if (idx < 0) continue;
 
51
         st = s->streams[idx];
 
52
         if (!main_timebase.num || !main_timebase.den) {
 
53
-            main_timebase.num = si.frames_per_second.den;
 
54
-            main_timebase.den = si.frames_per_second.num * 2;
 
55
+            main_timebase.num = si->frames_per_second.den;
 
56
+            main_timebase.den = si->frames_per_second.num * 2;
 
57
         }
 
58
-        st->start_time = si.first_field;
 
59
-        if (si.first_field != AV_NOPTS_VALUE && si.last_field != AV_NOPTS_VALUE)
 
60
-            st->duration = si.last_field - si.first_field;
 
61
+        st->start_time = si->first_field;
 
62
+        if (si->first_field != AV_NOPTS_VALUE && si->last_field != AV_NOPTS_VALUE)
 
63
+            st->duration = si->last_field - si->first_field;
 
64
     }
 
65
     if (len < 0)
 
66
         av_log(s, AV_LOG_ERROR, "invalid track description length specified\n");
 
67
@@ -422,6 +422,8 @@ static int gxf_packet(AVFormatContext *s, AVPacket *pkt) {
 
68
     AVIOContext *pb = s->pb;
 
69
     GXFPktType pkt_type;
 
70
     int pkt_len;
 
71
+    struct gxf_stream_info *si = s->priv_data;
 
72
+
 
73
     while (!pb->eof_reached) {
 
74
         AVStream *st;
 
75
         int track_type, track_id, ret;
 
76
@@ -473,6 +475,11 @@ static int gxf_packet(AVFormatContext *s, AVPacket *pkt) {
 
77
             avio_skip(pb, skip);
 
78
         pkt->stream_index = stream_index;
 
79
         pkt->dts = field_nr;
 
80
+
 
81
+        //set duration manually for DV or else lavf misdetects the frame rate
 
82
+        if (st->codec->codec_id == CODEC_ID_DVVIDEO)
 
83
+            pkt->duration = si->fields_per_frame;
 
84
+
 
85
         return ret;
 
86
     }
 
87
     return AVERROR(EIO);
 
88
@@ -518,7 +525,7 @@ static int64_t gxf_read_timestamp(AVFormatContext *s, int stream_index,
 
89
 AVInputFormat ff_gxf_demuxer = {
 
90
     "gxf",
 
91
     NULL_IF_CONFIG_SMALL("GXF format"),
 
92
-    0,
 
93
+    sizeof(struct gxf_stream_info),
 
94
     gxf_probe,
 
95
     gxf_header,
 
96
     gxf_packet,
 
97
-- 
 
98
1.7.4.1
 
99