Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(282)

Side by Side Diff: patches/to_upstream/04_mpeg4_video_to_elementary_stream.patch

Issue 789004: ffmpeg roll of source to mar 9 version... (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/ffmpeg/
Patch Set: '' Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 Index: patched-ffmpeg-mt/libavcodec/mpeg4video.h 1 Only in unpatched_ffmpeg-mt: ffmpeg-mt
2 =================================================================== 2 diff -rpu unpatched_ffmpeg-mt/libavcodec/Makefile ffmpeg-mt/libavcodec/Makefile
3 --- patched-ffmpeg-mt/libavcodec/mpeg4video.h» (revision 39691) 3 --- unpatched_ffmpeg-mt/libavcodec/Makefile» 2010-03-11 17:46:30 -0800
4 +++ patched-ffmpeg-mt/libavcodec/mpeg4video.h» (working copy) 4 +++ ffmpeg-mt/libavcodec/Makefile» 2010-03-11 19:12:02 -0800
5 @@ -86,6 +86,9 @@ 5 @@ -564,6 +564,14 @@ OBJS-$(CONFIG_VP3_PARSER) +
6 OBJS-$(CONFIG_AAC_ADTSTOASC_BSF) += aac_adtstoasc_bsf.o
7 OBJS-$(CONFIG_DUMP_EXTRADATA_BSF) += dump_extradata_bsf.o
8 OBJS-$(CONFIG_H264_MP4TOANNEXB_BSF) += h264_mp4toannexb_bsf.o
9 +OBJS-$(CONFIG_MPEG4VIDEO_ES_BSF) += mpeg4video_es_bsf.o \
10 + mpeg4videoenc.o ituh263enc.o \
11 + mpegvideo_enc.o motion_est.o \
12 + ratecontrol.o mpeg12data.o \
13 + aandcttab.o jfdctfst.o \
14 + jfdctint.o faandct.o \
15 + mpeg4video_parser.o mpegvideo.o \
16 + error_resilience.o
17 OBJS-$(CONFIG_IMX_DUMP_HEADER_BSF) += imx_dump_header_bsf.o
18 OBJS-$(CONFIG_MJPEGA_DUMP_HEADER_BSF) += mjpega_dump_header_bsf.o
19 OBJS-$(CONFIG_MOV2TEXTSUB_BSF) += movsub_bsf.o
20 Only in ffmpeg-mt/libavcodec: Makefile~
21 diff -rpu unpatched_ffmpeg-mt/libavcodec/allcodecs.c ffmpeg-mt/libavcodec/allcod ecs.c
22 --- unpatched_ffmpeg-mt/libavcodec/allcodecs.c» 2010-03-11 17:46:29 -0800
23 +++ ffmpeg-mt/libavcodec/allcodecs.c» 2010-03-11 19:12:02 -0800
24 @@ -384,6 +384,7 @@ void avcodec_register_all(void)
25 REGISTER_BSF (AAC_ADTSTOASC, aac_adtstoasc);
26 REGISTER_BSF (DUMP_EXTRADATA, dump_extradata);
27 REGISTER_BSF (H264_MP4TOANNEXB, h264_mp4toannexb);
28 + REGISTER_BSF (MPEG4VIDEO_ES, mpeg4video_es);
29 REGISTER_BSF (IMX_DUMP_HEADER, imx_dump_header);
30 REGISTER_BSF (MJPEGA_DUMP_HEADER, mjpega_dump_header);
31 REGISTER_BSF (MP3_HEADER_COMPRESS, mp3_header_compress);
32 Only in ffmpeg-mt/libavcodec: allcodecs.c~
33 diff -rpu unpatched_ffmpeg-mt/libavcodec/mpeg4video.h ffmpeg-mt/libavcodec/mpeg4 video.h
34 --- unpatched_ffmpeg-mt/libavcodec/mpeg4video.h»2010-03-11 17:46:30 -0800
35 +++ ffmpeg-mt/libavcodec/mpeg4video.h» 2010-03-11 19:12:02 -0800
36 @@ -91,6 +91,9 @@ void mpeg4_encode_mb(MpegEncContext *s,
6 void mpeg4_pred_ac(MpegEncContext * s, DCTELEM *block, int n, 37 void mpeg4_pred_ac(MpegEncContext * s, DCTELEM *block, int n,
7 int dir); 38 int dir);
8 void ff_set_mpeg4_time(MpegEncContext * s); 39 void ff_set_mpeg4_time(MpegEncContext * s);
9 +void mpeg4_encode_gop_header(MpegEncContext * s); 40 +void mpeg4_encode_gop_header(MpegEncContext * s);
10 +void mpeg4_encode_visual_object_header(MpegEncContext * s); 41 +void mpeg4_encode_visual_object_header(MpegEncContext * s);
11 +void mpeg4_encode_vol_header(MpegEncContext * s, int vo_number, int vol_number) ; 42 +void mpeg4_encode_vol_header(MpegEncContext * s, int vo_number, int vol_number) ;
12 void mpeg4_encode_picture_header(MpegEncContext *s, int picture_number); 43 void mpeg4_encode_picture_header(MpegEncContext *s, int picture_number);
13 44
14 int ff_mpeg4_decode_picture_header(MpegEncContext * s, GetBitContext *gb); 45 int ff_mpeg4_decode_picture_header(MpegEncContext * s, GetBitContext *gb);
15 Index: patched-ffmpeg-mt/libavcodec/mpeg4videoenc.c 46 Only in ffmpeg-mt/libavcodec: mpeg4video.h~
16 =================================================================== 47 Only in ffmpeg-mt/libavcodec: mpeg4video_es_bsf.c
17 --- patched-ffmpeg-mt/libavcodec/mpeg4videoenc.c» (revision 39691) 48 diff -rpu unpatched_ffmpeg-mt/libavcodec/mpeg4videoenc.c ffmpeg-mt/libavcodec/mp eg4videoenc.c
18 +++ patched-ffmpeg-mt/libavcodec/mpeg4videoenc.c» (working copy) 49 --- unpatched_ffmpeg-mt/libavcodec/mpeg4videoenc.c» 2010-03-11 17:46:30 -080 0
19 @@ -872,7 +872,7 @@ 50 +++ ffmpeg-mt/libavcodec/mpeg4videoenc.c» 2010-03-11 19:12:02 -0800
51 @@ -872,7 +872,7 @@ void ff_set_mpeg4_time(MpegEncContext *
20 } 52 }
21 } 53 }
22 54
23 -static void mpeg4_encode_gop_header(MpegEncContext * s){ 55 -static void mpeg4_encode_gop_header(MpegEncContext * s){
24 +void mpeg4_encode_gop_header(MpegEncContext * s){ 56 +void mpeg4_encode_gop_header(MpegEncContext * s){
25 int hours, minutes, seconds; 57 int hours, minutes, seconds;
26 int64_t time; 58 int64_t time;
27 59
28 @@ -902,7 +902,7 @@ 60 @@ -902,7 +902,7 @@ static void mpeg4_encode_gop_header(Mpeg
29 ff_mpeg4_stuffing(&s->pb); 61 ff_mpeg4_stuffing(&s->pb);
30 } 62 }
31 63
32 -static void mpeg4_encode_visual_object_header(MpegEncContext * s){ 64 -static void mpeg4_encode_visual_object_header(MpegEncContext * s){
33 +void mpeg4_encode_visual_object_header(MpegEncContext * s){ 65 +void mpeg4_encode_visual_object_header(MpegEncContext * s){
34 int profile_and_level_indication; 66 int profile_and_level_indication;
35 int vo_ver_id; 67 int vo_ver_id;
36 68
37 @@ -947,7 +947,7 @@ 69 @@ -947,7 +947,7 @@ static void mpeg4_encode_visual_object_h
38 ff_mpeg4_stuffing(&s->pb); 70 ff_mpeg4_stuffing(&s->pb);
39 } 71 }
40 72
41 -static void mpeg4_encode_vol_header(MpegEncContext * s, int vo_number, int vol_ number) 73 -static void mpeg4_encode_vol_header(MpegEncContext * s, int vo_number, int vol_ number)
42 +void mpeg4_encode_vol_header(MpegEncContext * s, int vo_number, int vol_number) 74 +void mpeg4_encode_vol_header(MpegEncContext * s, int vo_number, int vol_number)
43 { 75 {
44 int vo_ver_id; 76 int vo_ver_id;
45 77
46 Index: patched-ffmpeg-mt/libavcodec/allcodecs.c 78 diff -rpu unpatched_ffmpeg-mt/libavformat/mov.c ffmpeg-mt/libavformat/mov.c
47 =================================================================== 79 --- unpatched_ffmpeg-mt/libavformat/mov.c» 2010-03-11 17:46:31 -0800
48 --- patched-ffmpeg-mt/libavcodec/allcodecs.c» (revision 39691) 80 +++ ffmpeg-mt/libavformat/mov.c»2010-03-11 19:08:40 -0800
49 +++ patched-ffmpeg-mt/libavcodec/allcodecs.c» (working copy) 81 @@ -312,6 +312,8 @@ static int mov_read_dref(MOVContext *c,
50 @@ -377,6 +377,7 @@ 82 MOVDref *dref = &sc->drefs[i];
51 REGISTER_BSF (AAC_ADTSTOASC, aac_adtstoasc); 83 uint32_t size = get_be32(pb);
52 REGISTER_BSF (DUMP_EXTRADATA, dump_extradata); 84 int64_t next = url_ftell(pb) + size - 4;
53 REGISTER_BSF (H264_MP4TOANNEXB, h264_mp4toannexb); 85 + if (size < 8)
54 + REGISTER_BSF (MPEG4VIDEO_ES, mpeg4video_es); 86 + return -1;
55 REGISTER_BSF (IMX_DUMP_HEADER, imx_dump_header); 87
56 REGISTER_BSF (MJPEGA_DUMP_HEADER, mjpega_dump_header); 88 dref->type = get_le32(pb);
57 REGISTER_BSF (MP3_HEADER_COMPRESS, mp3_header_compress); 89 get_be32(pb); // version + flags
58 Index: patched-ffmpeg-mt/libavcodec/Makefile 90 Only in ffmpeg-mt/libavformat: mov.c~
59 ===================================================================
60 --- patched-ffmpeg-mt/libavcodec/Makefile» (revision 39691)
61 +++ patched-ffmpeg-mt/libavcodec/Makefile» (working copy)
62 @@ -526,6 +526,14 @@
63 OBJS-$(CONFIG_AAC_ADTSTOASC_BSF) += aac_adtstoasc_bsf.o
64 OBJS-$(CONFIG_DUMP_EXTRADATA_BSF) += dump_extradata_bsf.o
65 OBJS-$(CONFIG_H264_MP4TOANNEXB_BSF) += h264_mp4toannexb_bsf.o
66 +OBJS-$(CONFIG_MPEG4VIDEO_ES_BSF) += mpeg4video_es_bsf.o \
67 + mpeg4videoenc.o ituh263enc.o \
68 + mpegvideo_enc.o motion_est.o \
69 + ratecontrol.o mpeg12data.o \
70 + aandcttab.o jfdctfst.o \
71 + jfdctint.o faandct.o \
72 + mpeg4video_parser.o mpegvideo.o \
73 + error_resilience.o
74 OBJS-$(CONFIG_IMX_DUMP_HEADER_BSF) += imx_dump_header_bsf.o
75 OBJS-$(CONFIG_MJPEGA_DUMP_HEADER_BSF) += mjpega_dump_header_bsf.o
76 OBJS-$(CONFIG_MOV2TEXTSUB_BSF) += movsub_bsf.o
77 Index: patched-ffmpeg-mt/libavcodec/mpeg4video_es_bsf.c
78 ===================================================================
79 --- patched-ffmpeg-mt/libavcodec/mpeg4video_es_bsf.c» (revision 0)
80 +++ patched-ffmpeg-mt/libavcodec/mpeg4video_es_bsf.c» (revision 0)
81 @@ -0,0 +1,91 @@
82 +/*
83 + * Copyright (c) 2009 Google Inc.
84 + *
85 + * This file is part of FFmpeg.
86 + *
87 + * FFmpeg is free software; you can redistribute it and/or
88 + * modify it under the terms of the GNU Lesser General Public
89 + * License as published by the Free Software Foundation; either
90 + * version 2.1 of the License, or (at your option) any later version.
91 + *
92 + * FFmpeg is distributed in the hope that it will be useful,
93 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
94 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
95 + * Lesser General Public License for more details.
96 + *
97 + * You should have received a copy of the GNU Lesser General Public
98 + * License along with FFmpeg; if not, write to the Free Software
99 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
100 + */
101 +
102 +#include "avcodec.h"
103 +#include "mpegvideo.h"
104 +
105 +static int mpeg4video_es_filter(AVBitStreamFilterContext *bsfc,
106 +» » » » AVCodecContext *avctx, const char *args,
107 +» » » » uint8_t **poutbuf, int *poutbuf_size,
108 +» » » » const uint8_t *buf, int buf_size,
109 +» » » » int keyframe) {
110 + AVCodecParserContext *cpc;
111 + ParseContext1 *pc;
112 + MpegEncContext *s;
113 + int first_picture;
114 + int ret;
115 + uint8_t *frame_data;
116 + int frame_size;
117 + int outbuf_idx = 0;
118 + int count = 0;
119 +
120 + if (avctx->codec_id != CODEC_ID_MPEG4) {
121 + av_log(NULL, AV_LOG_ERROR, "Codec is not MPEG4\n");
122 + return -1;
123 + }
124 +
125 + if (!bsfc->parser) {
126 + bsfc->parser = av_parser_init(CODEC_ID_MPEG4);
127 + }
128 + cpc = bsfc->parser;
129 + pc = cpc->priv_data;
130 + s = pc->enc;
131 +
132 + *poutbuf = NULL;
133 + *poutbuf_size = 0;
134 + while (buf_size > 0) {
135 + first_picture = pc->first_picture;
136 + ret = cpc->parser->parser_parse(cpc, avctx, &frame_data, &frame_size, b uf, buf_size);
137 +
138 + if (ret < 0)
139 + return ret;
140 +
141 + buf_size -= ret;
142 + buf += ret;
143 +
144 + // If the first picture is decoded, encode the header.
145 + if (first_picture && !pc->first_picture) {
146 + assert(!*poutbuf);
147 + *poutbuf = av_malloc(1024);
148 + *poutbuf_size = 1024;
149 + init_put_bits(&s->pb, *poutbuf, 1024);
150 + mpeg4_encode_visual_object_header(s);
151 + mpeg4_encode_vol_header(s, 0, 0);
152 + flush_put_bits(&s->pb);
153 + outbuf_idx = (put_bits_count(&s->pb)+7)>>3;
154 + }
155 +
156 + if (!frame_size)
157 + break;
158 +
159 + *poutbuf = av_fast_realloc(*poutbuf, poutbuf_size, outbuf_idx + frame_s ize);
160 + memcpy(*poutbuf + outbuf_idx, frame_data, frame_size);
161 + outbuf_idx += frame_size;
162 + }
163 +
164 + *poutbuf_size = outbuf_idx;
165 + return 0;
166 +}
167 +
168 +AVBitStreamFilter mpeg4video_es_bsf = {
169 + "mpeg4video_es",
170 + 0,
171 + mpeg4video_es_filter,
172 +};
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698