Browse code

ffserver: Remove extract_mpeg4_header()

This should not be needed, our AVParsers should do this
I do not have a testcase though, please help testing this and please
add fate tests if you can.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>

Michael Niedermayer authored on 2016/11/24 02:40:25
Showing 1 changed files
... ...
@@ -3599,57 +3599,6 @@ static void remove_stream(FFServerStream *stream)
3599 3599
     }
3600 3600
 }
3601 3601
 
3602
-/* specific MPEG4 handling : we extract the raw parameters */
3603
-static void extract_mpeg4_header(AVFormatContext *infile)
3604
-{
3605
-    int mpeg4_count, i, size;
3606
-    AVPacket pkt;
3607
-    AVStream *st;
3608
-    const uint8_t *p;
3609
-
3610
-    infile->flags |= AVFMT_FLAG_NOFILLIN | AVFMT_FLAG_NOPARSE;
3611
-
3612
-    mpeg4_count = 0;
3613
-    for(i=0;i<infile->nb_streams;i++) {
3614
-        st = infile->streams[i];
3615
-        if (st->codec->codec_id == AV_CODEC_ID_MPEG4 &&
3616
-            st->codec->extradata_size == 0) {
3617
-            mpeg4_count++;
3618
-        }
3619
-    }
3620
-    if (!mpeg4_count)
3621
-        return;
3622
-
3623
-    printf("MPEG4 without extra data: trying to find header in %s\n",
3624
-           infile->filename);
3625
-    while (mpeg4_count > 0) {
3626
-        if (av_read_frame(infile, &pkt) < 0)
3627
-            break;
3628
-        st = infile->streams[pkt.stream_index];
3629
-        if (st->codec->codec_id == AV_CODEC_ID_MPEG4 &&
3630
-            st->codec->extradata_size == 0) {
3631
-            av_freep(&st->codec->extradata);
3632
-            /* fill extradata with the header */
3633
-            /* XXX: we make hard suppositions here ! */
3634
-            p = pkt.data;
3635
-            while (p < pkt.data + pkt.size - 4) {
3636
-                /* stop when vop header is found */
3637
-                if (p[0] == 0x00 && p[1] == 0x00 &&
3638
-                    p[2] == 0x01 && p[3] == 0xb6) {
3639
-                    size = p - pkt.data;
3640
-                    st->codec->extradata = av_mallocz(size + AV_INPUT_BUFFER_PADDING_SIZE);
3641
-                    st->codec->extradata_size = size;
3642
-                    memcpy(st->codec->extradata, pkt.data, size);
3643
-                    break;
3644
-                }
3645
-                p++;
3646
-            }
3647
-            mpeg4_count--;
3648
-        }
3649
-        av_packet_unref(&pkt);
3650
-    }
3651
-}
3652
-
3653 3602
 /* compute the needed AVStream for each file */
3654 3603
 static void build_file_streams(void)
3655 3604
 {
... ...
@@ -3700,7 +3649,6 @@ static void build_file_streams(void)
3700 3700
                 avformat_close_input(&infile);
3701 3701
                 goto fail;
3702 3702
             }
3703
-            extract_mpeg4_header(infile);
3704 3703
 
3705 3704
             for(i=0;i<infile->nb_streams;i++)
3706 3705
                 add_av_stream1(stream, infile->streams[i]->codec, 1);