int cFfmpegDecoder::IO_read_packet(void *arg, uint8_t *buffer, int buf_size)
{
/// Read the data
/// do the pre-processing
}

int main()
{
    uint8_t    buffer[bufsize];
    AVProbeData   pd;
    pd.filename = ".ts";
    pd.buf = buffer;
    pd.buf_size = bufsize;

    // Read a tini bit of the input.
    IO_read_packet(this, buffer, bufsize);

    // Check input format
    if( !( fmt = av_probe_input_format( &pd, 1 ) ) )
        throw ("Can't find input format");

    cout << "Video Format: " << fmt->name << endlog;

    // Init io module for input
    init_put_byte( &io, buffer, bufsize, 0, this, IO_read_packet, 0, 0 );
    memset(&params, 0, sizeof(params));

    if( av_open_input_stream( &ic, &io, "", fmt, &params ) )
        throw TRANSCODE_EXCEPTION("Can not open input stream");


}

On Mon, Mar 9, 2009 at 12:18 AM, Tom Handal <[email protected]> wrote:
> Hi all,
>
>    Thanks in advance for answering my question...
>
> I understand that av_open_input_file can be used to open a file, stream,
> etc.   Most of the files/streams I am working with are MPEG2-TS and I need
> to do some pre-processing on the raw TS packets before I pass them to FFMpeg
> for de-muxing, decoding, etc.
>
> I was wondering if there was a way I could read from the file/socket myself
> so I can run my own pre-processing on the TS packets, then pass the TS
> packets to a function similar to av_read_frame to proceed as normal?
> Essentially, I want to take av_open_input_file out of the loop and just open
> the file/stream myself and proceed...
>
> Thanks!
> Tom
> _______________________________________________
> libav-user mailing list
> [email protected]
> https://lists.mplayerhq.hu/mailman/listinfo/libav-user
>
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to