Originally committed as revision 24980 to svn://svn.ffmpeg.org/ffmpeg/trunk
| ... | ... |
@@ -85,7 +85,7 @@ OBJS-$(CONFIG_GIF_MUXER) += gif.o |
| 85 | 85 |
OBJS-$(CONFIG_GSM_DEMUXER) += raw.o |
| 86 | 86 |
OBJS-$(CONFIG_GXF_DEMUXER) += gxf.o |
| 87 | 87 |
OBJS-$(CONFIG_GXF_MUXER) += gxfenc.o audiointerleave.o |
| 88 |
-OBJS-$(CONFIG_H261_DEMUXER) += raw.o |
|
| 88 |
+OBJS-$(CONFIG_H261_DEMUXER) += h261dec.o raw.o |
|
| 89 | 89 |
OBJS-$(CONFIG_H261_MUXER) += raw.o |
| 90 | 90 |
OBJS-$(CONFIG_H263_DEMUXER) += h263dec.o raw.o |
| 91 | 91 |
OBJS-$(CONFIG_H263_MUXER) += raw.o |
| 92 | 92 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,75 @@ |
| 0 |
+/* |
|
| 1 |
+ * RAW H.261 video demuxer |
|
| 2 |
+ * Copyright (c) 2009 Michael Niedermayer <michaelni@gmx.at> |
|
| 3 |
+ * |
|
| 4 |
+ * This file is part of FFmpeg. |
|
| 5 |
+ * |
|
| 6 |
+ * FFmpeg is free software; you can redistribute it and/or |
|
| 7 |
+ * modify it under the terms of the GNU Lesser General Public |
|
| 8 |
+ * License as published by the Free Software Foundation; either |
|
| 9 |
+ * version 2.1 of the License, or (at your option) any later version. |
|
| 10 |
+ * |
|
| 11 |
+ * FFmpeg is distributed in the hope that it will be useful, |
|
| 12 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 13 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
| 14 |
+ * Lesser General Public License for more details. |
|
| 15 |
+ * |
|
| 16 |
+ * You should have received a copy of the GNU Lesser General Public |
|
| 17 |
+ * License along with FFmpeg; if not, write to the Free Software |
|
| 18 |
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
| 19 |
+ */ |
|
| 20 |
+ |
|
| 21 |
+#include "libavcodec/get_bits.h" |
|
| 22 |
+#include "avformat.h" |
|
| 23 |
+#include "raw.h" |
|
| 24 |
+ |
|
| 25 |
+static int h261_probe(AVProbeData *p) |
|
| 26 |
+{
|
|
| 27 |
+ uint32_t code= -1; |
|
| 28 |
+ int i; |
|
| 29 |
+ int valid_psc=0; |
|
| 30 |
+ int invalid_psc=0; |
|
| 31 |
+ int next_gn=0; |
|
| 32 |
+ int src_fmt=0; |
|
| 33 |
+ GetBitContext gb; |
|
| 34 |
+ |
|
| 35 |
+ init_get_bits(&gb, p->buf, p->buf_size*8); |
|
| 36 |
+ |
|
| 37 |
+ for(i=0; i<p->buf_size*8; i++){
|
|
| 38 |
+ if ((code & 0x01ff0000) || !(code & 0xff00)) {
|
|
| 39 |
+ code = (code<<8) + get_bits(&gb, 8); |
|
| 40 |
+ i += 7; |
|
| 41 |
+ } else |
|
| 42 |
+ code = (code<<1) + get_bits1(&gb); |
|
| 43 |
+ if ((code & 0xffff0000) == 0x10000) {
|
|
| 44 |
+ int gn= (code>>12)&0xf; |
|
| 45 |
+ if(!gn) |
|
| 46 |
+ src_fmt= code&8; |
|
| 47 |
+ if(gn != next_gn) invalid_psc++; |
|
| 48 |
+ else valid_psc++; |
|
| 49 |
+ |
|
| 50 |
+ if(src_fmt){ // CIF
|
|
| 51 |
+ next_gn= (gn+1 )%13; |
|
| 52 |
+ }else{ //QCIF
|
|
| 53 |
+ next_gn= (gn+1+!!gn)% 7; |
|
| 54 |
+ } |
|
| 55 |
+ } |
|
| 56 |
+ } |
|
| 57 |
+ if(valid_psc > 2*invalid_psc + 6){
|
|
| 58 |
+ return 50; |
|
| 59 |
+ }else if(valid_psc > 2*invalid_psc + 2) |
|
| 60 |
+ return 25; |
|
| 61 |
+ return 0; |
|
| 62 |
+} |
|
| 63 |
+ |
|
| 64 |
+AVInputFormat h261_demuxer = {
|
|
| 65 |
+ "h261", |
|
| 66 |
+ NULL_IF_CONFIG_SMALL("raw H.261"),
|
|
| 67 |
+ 0, |
|
| 68 |
+ h261_probe, |
|
| 69 |
+ ff_raw_video_read_header, |
|
| 70 |
+ ff_raw_read_partial_packet, |
|
| 71 |
+ .flags= AVFMT_GENERIC_INDEX, |
|
| 72 |
+ .extensions = "h261", |
|
| 73 |
+ .value = CODEC_ID_H261, |
|
| 74 |
+}; |
| ... | ... |
@@ -241,47 +241,6 @@ int ff_raw_video_read_header(AVFormatContext *s, |
| 241 | 241 |
} |
| 242 | 242 |
#endif |
| 243 | 243 |
|
| 244 |
-#if CONFIG_H261_DEMUXER |
|
| 245 |
-static int h261_probe(AVProbeData *p) |
|
| 246 |
-{
|
|
| 247 |
- uint32_t code= -1; |
|
| 248 |
- int i; |
|
| 249 |
- int valid_psc=0; |
|
| 250 |
- int invalid_psc=0; |
|
| 251 |
- int next_gn=0; |
|
| 252 |
- int src_fmt=0; |
|
| 253 |
- GetBitContext gb; |
|
| 254 |
- |
|
| 255 |
- init_get_bits(&gb, p->buf, p->buf_size*8); |
|
| 256 |
- |
|
| 257 |
- for(i=0; i<p->buf_size*8; i++){
|
|
| 258 |
- if ((code & 0x01ff0000) || !(code & 0xff00)) {
|
|
| 259 |
- code = (code<<8) + get_bits(&gb, 8); |
|
| 260 |
- i += 7; |
|
| 261 |
- } else |
|
| 262 |
- code = (code<<1) + get_bits1(&gb); |
|
| 263 |
- if ((code & 0xffff0000) == 0x10000) {
|
|
| 264 |
- int gn= (code>>12)&0xf; |
|
| 265 |
- if(!gn) |
|
| 266 |
- src_fmt= code&8; |
|
| 267 |
- if(gn != next_gn) invalid_psc++; |
|
| 268 |
- else valid_psc++; |
|
| 269 |
- |
|
| 270 |
- if(src_fmt){ // CIF
|
|
| 271 |
- next_gn= (gn+1 )%13; |
|
| 272 |
- }else{ //QCIF
|
|
| 273 |
- next_gn= (gn+1+!!gn)% 7; |
|
| 274 |
- } |
|
| 275 |
- } |
|
| 276 |
- } |
|
| 277 |
- if(valid_psc > 2*invalid_psc + 6){
|
|
| 278 |
- return 50; |
|
| 279 |
- }else if(valid_psc > 2*invalid_psc + 2) |
|
| 280 |
- return 25; |
|
| 281 |
- return 0; |
|
| 282 |
-} |
|
| 283 |
-#endif |
|
| 284 |
- |
|
| 285 | 244 |
#if CONFIG_DIRAC_DEMUXER |
| 286 | 245 |
static int dirac_probe(AVProbeData *p) |
| 287 | 246 |
{
|
| ... | ... |
@@ -513,20 +472,6 @@ AVInputFormat gsm_demuxer = {
|
| 513 | 513 |
}; |
| 514 | 514 |
#endif |
| 515 | 515 |
|
| 516 |
-#if CONFIG_H261_DEMUXER |
|
| 517 |
-AVInputFormat h261_demuxer = {
|
|
| 518 |
- "h261", |
|
| 519 |
- NULL_IF_CONFIG_SMALL("raw H.261"),
|
|
| 520 |
- 0, |
|
| 521 |
- h261_probe, |
|
| 522 |
- ff_raw_video_read_header, |
|
| 523 |
- ff_raw_read_partial_packet, |
|
| 524 |
- .flags= AVFMT_GENERIC_INDEX, |
|
| 525 |
- .extensions = "h261", |
|
| 526 |
- .value = CODEC_ID_H261, |
|
| 527 |
-}; |
|
| 528 |
-#endif |
|
| 529 |
- |
|
| 530 | 516 |
#if CONFIG_H261_MUXER |
| 531 | 517 |
AVOutputFormat h261_muxer = {
|
| 532 | 518 |
"h261", |