You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
doc/examples/demuxing_decoding: Drop old api mode, because the code fails to build otherwise
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
@@ -60,12 +60,11 @@ static int audio_frame_count = 0;
|
|||||||
* appropriate to your needs. Look for the use of api_mode in this example to
|
* appropriate to your needs. Look for the use of api_mode in this example to
|
||||||
* see what are the differences of API usage between them */
|
* see what are the differences of API usage between them */
|
||||||
enum {
|
enum {
|
||||||
API_MODE_OLD = 0, /* old method, deprecated */
|
|
||||||
API_MODE_NEW_API_REF_COUNT = 1, /* new method, using the frame reference counting */
|
API_MODE_NEW_API_REF_COUNT = 1, /* new method, using the frame reference counting */
|
||||||
API_MODE_NEW_API_NO_REF_COUNT = 2, /* new method, without reference counting */
|
API_MODE_NEW_API_NO_REF_COUNT = 2, /* new method, without reference counting */
|
||||||
};
|
};
|
||||||
|
|
||||||
static int api_mode = API_MODE_OLD;
|
static int api_mode = API_MODE_NEW_API_NO_REF_COUNT;
|
||||||
|
|
||||||
static int decode_packet(int *got_frame, int cached)
|
static int decode_packet(int *got_frame, int cached)
|
||||||
{
|
{
|
||||||
@@ -243,8 +242,7 @@ int main (int argc, char **argv)
|
|||||||
}
|
}
|
||||||
if (argc == 5) {
|
if (argc == 5) {
|
||||||
const char *mode = argv[1] + strlen("-refcount=");
|
const char *mode = argv[1] + strlen("-refcount=");
|
||||||
if (!strcmp(mode, "old")) api_mode = API_MODE_OLD;
|
if (!strcmp(mode, "new_norefcount")) api_mode = API_MODE_NEW_API_NO_REF_COUNT;
|
||||||
else if (!strcmp(mode, "new_norefcount")) api_mode = API_MODE_NEW_API_NO_REF_COUNT;
|
|
||||||
else if (!strcmp(mode, "new_refcount")) api_mode = API_MODE_NEW_API_REF_COUNT;
|
else if (!strcmp(mode, "new_refcount")) api_mode = API_MODE_NEW_API_REF_COUNT;
|
||||||
else {
|
else {
|
||||||
fprintf(stderr, "unknow mode '%s'\n", mode);
|
fprintf(stderr, "unknow mode '%s'\n", mode);
|
||||||
@@ -315,11 +313,6 @@ int main (int argc, char **argv)
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* When using the new API, you need to use the libavutil/frame.h API, while
|
|
||||||
* the classic frame management is available in libavcodec */
|
|
||||||
if (api_mode == API_MODE_OLD)
|
|
||||||
frame = avcodec_alloc_frame();
|
|
||||||
else
|
|
||||||
frame = av_frame_alloc();
|
frame = av_frame_alloc();
|
||||||
if (!frame) {
|
if (!frame) {
|
||||||
fprintf(stderr, "Could not allocate frame\n");
|
fprintf(stderr, "Could not allocate frame\n");
|
||||||
@@ -397,9 +390,6 @@ end:
|
|||||||
fclose(video_dst_file);
|
fclose(video_dst_file);
|
||||||
if (audio_dst_file)
|
if (audio_dst_file)
|
||||||
fclose(audio_dst_file);
|
fclose(audio_dst_file);
|
||||||
if (api_mode == API_MODE_OLD)
|
|
||||||
avcodec_free_frame(&frame);
|
|
||||||
else
|
|
||||||
av_frame_free(&frame);
|
av_frame_free(&frame);
|
||||||
av_free(video_dst_data[0]);
|
av_free(video_dst_data[0]);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user